package com.h1909d.weinfo.model;

import com.h1909d.weinfo.base.BaseModel;
import com.h1909d.weinfo.bean.DailyNewsBean;
import com.h1909d.weinfo.bean.SectionsBean;
import com.h1909d.weinfo.net.HttpUtil;
import com.h1909d.weinfo.net.ResultCallBack;
import com.h1909d.weinfo.net.ResultSubscriber;
import com.h1909d.weinfo.net.RxUtils;

import io.reactivex.subscribers.ResourceSubscriber;


public class SectionsModel extends BaseModel {

    public void getLatestSection(final ResultCallBack<SectionsBean>callBack){


        HttpUtil.getInstance()
                .getSectionService()
                .getLatestSection()
                .compose(RxUtils.<SectionsBean>rxSchedulerHelper())
                .subscribeWith(new ResourceSubscriber<SectionsBean>() {
                    @Override
                    public void onNext(SectionsBean sectionsBean) {
                        callBack.onSuccess(sectionsBean);
                    }

                    @Override
                    public void onError(Throwable t) {

                    }

                    @Override
                    public void onComplete() {

                    }
                });

    }

}
